package com.yyi.springcloud.controller;
//
//                       _oo0oo_
//                      o8888888o
//                      88" . "88
//                      (| -_- |)
//                      0\  =  /0
//                    ___/`---'\___
//                  .' \\|     |// '.
//                 / \\|||  :  |||// \
//                / _||||| -:- |||||- \
//               |   | \\\  -  /// |   |
//               | \_|  ''\---/''  |_/ |
//               \  .-\__  '-'  ___/-. /
//             ___'. .'  /--.--\  `. .'___
//          ."" '<  `.___\_<|>_/___.' >' "".
//         | | :  `- \`.;`\ _ /`;.`/ - ` : | |
//         \  \ `_.   \_ __\ /__ _/   .-` /  /
//     =====`-.____`.___ \_____/___.-`___.-'=====
//                       `=---='
//
//
//     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
//               佛祖保佑         永无BUG
//

import com.sun.org.apache.bcel.internal.generic.NEW;
import com.yyi.springcloud.common.ResponseResult;
import com.yyi.springcloud.service.SearchService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

import javax.servlet.http.HttpServletRequest;

/**
 * @author: yyi
 * @date: 2019/7/11 16:15
 * @parameters:
 * @desc:
 **/
@RestController
@RequestMapping("/consumer/SearchInfoAPI")
public class SearchController {
    private Logger logger = LoggerFactory.getLogger(DataListController.class);
    @Autowired
    private SearchService searchService;
    //设置搜索引擎
    //http://localhost/consumer/SearchInfoAPI/getSearchData?queryString=物联网
    @CrossOrigin
    @RequestMapping(value = "/getSearchData", method = RequestMethod.GET)
    public ResponseResult getIspByName(String queryString){
        /**
         * RestTemplate的形式
         * **/
       /* String queryString = request.getParameter("queryString");
        String url = REST_URL_PREFIX + "/mysqlapi/SearchInfoAPI/getSearchData?queryString="+queryString;
        logger.info("消费端:SearchController请求路径:------->"+url);
        return restTemplate.getForObject(url,ResponseResult.class);*/
    /***
     * feign的形式
     * **/
        System.out.println("SearchController---------->:"+queryString);

     return searchService.getIspByName(queryString);

    }
}
